import java.util.*;
public class Driver {

	
	
	public static void main(String[] args){
		Scanner inFile = null;
		Record record=new Record();		//record object, inserted into queue
	    Q theQ=new Q();					//creates queue object
	    
		inFile = FileUtils.ScannerOpen("zin");		//opens input file
	
	    int size=inFile.nextInt();			//reads how many record in file
	    int count =0;		//used in while loop, must be less than number of records to read (aka size)
	   
	    //adds records to the queue and prints out what is being added and the current size
	    while(inFile.hasNext()&& count<size){
	    	
	    	record=Record.readRecord(inFile,count);
	    	theQ.enterOntoQ(record);
	 
	    System.out.print("Adding: "+record.toString());
	    System.out.println("	Size is: "+theQ.getSize());
	    System.out.println("List is now: "+theQ.toString());
	    
	    count++;
	    }

	 
	    count=0;
	    System.out.println();
	    //removes elements from the queue, prints out the Record currently on top of queue and prints current size
	    while(count<theQ.getSize()){
	    	System.out.println("Now the top element is: "+theQ.peek().toString()+"	Size is:"+theQ.getSize());
	    	System.out.print("	Removing:   ");
	    	System.out.println(theQ.takeFromQ().toString());
	    	System.out.println("The List is now: "+ theQ.toString());
	    
	    }
	    
		
		
	}
}
